package com.scheduling.inventory.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 产品库存实体
 *
 * @author 开发团队
 * @since 2025-05-29
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("product_inventory")
@Schema(description = "产品库存")
public class ProductInventory implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 库存ID
     */
    @TableId(value = "inventory_id", type = IdType.ASSIGN_ID)
    @Schema(description = "库存ID")
    private String inventoryId;

    /**
     * 产品ID
     */
    @TableField("product_id")
    @Schema(description = "产品ID")
    private String productId;

    /**
     * 在制品数量
     */
    @TableField("wip_quantity")
    @Schema(description = "在制品数量")
    private BigDecimal wipQuantity;

    /**
     * 完成品数量
     */
    @TableField("finished_quantity")
    @Schema(description = "完成品数量")
    private BigDecimal finishedQuantity;

    /**
     * 最后更新时间
     */
    @TableField(value = "last_update", fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "最后更新时间")
    private LocalDateTime lastUpdate;

    // ========== 关联字段 ==========

    /**
     * 产品名称（关联查询）
     */
    @TableField(exist = false)
    @Schema(description = "产品名称")
    private String productName;

    /**
     * 产品描述（关联查询）
     */
    @TableField(exist = false)
    @Schema(description = "产品描述")
    private String productDescription;

    /**
     * 总库存数量（计算字段）
     */
    @TableField(exist = false)
    @Schema(description = "总库存数量")
    private BigDecimal totalQuantity;
} 